@echo off
REM ======================================================================
REM Clean required environment variables
REM ======================================================================
set PATH=
set CLASSPATH=
set ANT_HOME=
set ANT_CP=

if not exist "sdk" goto :NoSDKFound

if not exist "platform" goto :NoPlatformFound

if not defined JAVA_HOME 		goto :NoJavaFound

set BUILD_HOME=%CD%
set BCPSDK_HOME=sdk
set CORDYS_INSTALL_DIR=platform
set BCPSDK_JAVA_HOME=%JAVA_HOME%

REM ======================================================================
REM Set environment from BCPSDK
REM ======================================================================
call "%~dp0sdk\setenv.bat"

set ANT_CP=%ANT_CP%;%BCPSDK_HOME%\common\junit\junit-4.8.2.jar
set ANT_CP=%ANT_CP%;%BCPSDK_HOME%\common\uiunit\UIUnit-latest.jar
set ANT_CP=%ANT_CP%;%BCPSDK_HOME%\common\uiunit\uiunit-ajaxtoolkit.jar
set ANT_CP=%ANT_CP%;%BCPSDK_HOME%\common\uiunit\webrenderer-latest.jar
set ANT_CP=%ANT_CP%;%BCPSDK_HOME%\common\uiunit\webrenderer-win-latest.jar
set ANT_CP=%ANT_CP%;%BCPSDK_HOME%\common\uiunit\corecomponents-win.jar

REM =======================================================================
REM Setting environment for isv task
REM =======================================================================
set ANT_CP=%JAVA_HOME%\lib\tools.jar;%ANT_CP%;
set ANT_CP=%ANT_CP%;platform\ext\ldap.jar
set ANT_CP=%ANT_CP%;platform\ext\jdbcappender.jar
set ANT_CP=%ANT_CP%;platform\ext\log4j-1.2.15.jar
set ANT_CP=%ANT_CP%;platform\components\eibxml\eibxml.jar
set ANT_CP=%ANT_CP%;platform\components\basicutil\basicutil.jar
set ANT_CP=%ANT_CP%;platform\components\ccutil\ccutil.jar
set ANT_CP=%ANT_CP%;platform\components\esbclient\esbclient.jar
set ANT_CP=%ANT_CP%;platform\components\esbserver\esbserver.jar
set ANT_CP=%ANT_CP%;platform\components\isvpconn\isvpconn.jar
set ANT_CP=%ANT_CP%;platform\components\managementlib\managementlib.jar
set PATH=%PATH%;platform\lib
REM =======================================================================

goto :end

:NoSDKFound
echo sdk folder is missing
goto :end

:NoPlatformFound
echo platform folder is missing
goto :end

:NoJavaFound
echo JAVA_HOME environment variable is not set.
goto :end

:end